package me.ywy.apt.ormdb.utils;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.ByteArrayOutputStream;

/**
 * Created by ywy on 2018-04-11.
 */
public class BitmapUtils {

    public static byte[] BitmapConvertToByte(Bitmap bit){
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bit.compress(Bitmap.CompressFormat.PNG ,100 , baos);
        return baos.toByteArray();
    }

    public static Bitmap Byte2Bitmap(byte[] bytes){
        Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
        return bitmap;
    }
}
